const { checkTokenUser } = require("../middleware/jwt");

module.exports = (app) => {
  const userCartController = require("../controllers/cart");

  // 权限管理 需要注册中间件
  app.use("/user/cart", checkTokenUser);
  // 购物车增删改查
  app.post("/user/cart", userCartController.addCart);
  app.delete("/user/cart/:id", userCartController.deleteCart);
  app.put("/user/cart/:id", userCartController.updateCart);
  app.get("/user/cart", userCartController.getCart);
  // 清空购物车
  app.delete("/user/cart", userCartController.clearCart);
};
